
cd ""

insheet using "Holbein Winter 2019_March 7, 2019_15.13.csv", clear

gen demand_effects=1 if  fl_11_do_datingintrodemandeffect==1
replace demand_effects=0 if  fl_11_do_datingintro==1

*fixing partyid
gen viewer_party = .
replace viewer_party = 0 if q13 == "Democrat"
replace viewer_party = 1 if q13 == "Independent"
replace viewer_party = 2 if q13 == "Republican"

gen treatment=0 if q20_1~=. | q38_1~=. // control: saw no partisan information (female first, male second)
replace treatment=1 if q32_1~=. | q50_1~=. // republican (female first, male second)
replace treatment=2 if q26_1~=. | q44_1~=. // democrat (female first, male second)

gen same_party = .
replace same_party = 1 if viewer_party == 0 & treatment == 2
replace same_party = 1 if viewer_party == 2 & treatment == 1

replace same_party = 0 if viewer_party == 0 & treatment == 1
replace same_party = 0 if viewer_party == 2 & treatment == 2

gen attractiveness_score=q20_1
replace attractiveness_score=q38_1 if attractiveness_score==.
replace attractiveness_score=q32_1 if attractiveness_score==.
replace attractiveness_score=q50_1 if attractiveness_score==.
replace attractiveness_score=q26_1 if attractiveness_score==.
replace attractiveness_score=q44_1 if attractiveness_score==.

*Overall Effects
regress attractiveness_score i.treatment 
regress attractiveness_score i.treatment if q13== "Democrat"
regress attractiveness_score i.treatment if q13== "Independent"
regress attractiveness_score i.treatment if q13== "Republican"


*Demand Effects
regress attractiveness_score i.treatment##i.demand_effects
regress attractiveness_score i.treatment##i.demand_effects if q13== "Democrat"
regress attractiveness_score i.treatment##i.demand_effects if q13== "Independent"
regress attractiveness_score i.treatment##i.demand_effects if q13== "Republican"

***Create the other outcome variables'
*Respond to a message m
gen respond=q21
replace respond=q39 if respond==""
replace respond=q33 if respond==""
replace respond=q51 if respond==""
replace respond=q27 if respond==""
replace respond=q45 if respond==""
replace respond="1" if respond=="Definitely not"
replace respond="2" if respond=="Probably not"
replace respond="3" if respond=="Possibly"
replace respond="4" if respond=="Probably"
replace respond="5" if respond=="Very probably"
replace respond="6" if respond=="Definitely"

destring respond, replace

*Go on a Date
gen go_date=q22
replace go_date=q40 if go_date==""
replace go_date=q34 if go_date==""
replace go_date=q52 if go_date==""
replace go_date=q28 if go_date==""
replace go_date=q46 if go_date==""
replace go_date="1" if go_date=="Definitely not"
replace go_date="2" if go_date=="Probably not"
replace go_date="3" if go_date=="Possibly"
replace go_date="4" if go_date=="Probably"
replace go_date="5" if go_date=="Very probably"
replace go_date="6" if go_date=="Definitely"

destring go_date, replace

*Relationship
gen relationship=q23
replace relationship=q41 if relationship==""
replace relationship=q35 if relationship==""
replace relationship=q53 if relationship==""
replace relationship=q29 if relationship==""
replace relationship=q47 if relationship==""
replace relationship="1" if relationship=="Definitely not"
replace relationship="2" if relationship=="Probably not"
replace relationship="3" if relationship=="Possibly"
replace relationship="4" if relationship=="Probably"
replace relationship="5" if relationship=="Very probably"
replace relationship="6" if relationship=="Definitely"

destring relationship, replace

*Set Up With a Friend
gen set_up=q24
replace set_up=q42 if set_up==""
replace set_up=q36 if set_up==""
replace set_up=q54 if set_up==""
replace set_up=q30 if set_up==""
replace set_up=q48 if set_up==""
replace set_up="1" if set_up=="Definitely not"
replace set_up="2" if set_up=="Probably not"
replace set_up="3" if set_up=="Possibly"
replace set_up="4" if set_up=="Probably"
replace set_up="5" if set_up=="Very probably"
replace set_up="6" if set_up=="Definitely"

destring set_up, replace


regress respond i.treatment##i.demand_effects
regress respond i.treatment##i.demand_effects if q13== "Democrat"
regress respond i.treatment##i.demand_effects if q13== "Independent"
regress respond i.treatment##i.demand_effects if q13== "Republican"



regress go_date i.treatment##i.demand_effects
regress go_date i.treatment##i.demand_effects if q13== "Democrat"
regress go_date i.treatment##i.demand_effects if q13== "Independent"
regress go_date i.treatment##i.demand_effects if q13== "Republican"


regress relationship i.treatment##i.demand_effects
regress relationship i.treatment##i.demand_effects if q13== "Democrat"
regress relationship i.treatment##i.demand_effects if q13== "Independent"
regress relationship i.treatment##i.demand_effects if q13== "Republican"


regress set_up i.treatment##i.demand_effects
regress set_up i.treatment##i.demand_effects if q13== "Democrat"
regress set_up i.treatment##i.demand_effects if q13== "Independent"
regress set_up i.treatment##i.demand_effects if q13== "Republican"


*COMPARING TO OTHER STUDIES: Effects in No Demand Effect

egen attractiveness_score_std=std(attractiveness_score), mean(0) std(1)
egen respond_std=std(respond), mean(0) std(1)
egen relationship_std=std(relationship), mean(0) std(1)

gen age=2018-q2

regress attractiveness_score_std same_party if demand_effects==0 // effects in the attractiveness meta analysis
regress respond_std same_party if demand_effects==0
regress relationship_std same_party if demand_effects==0

	regress attractiveness_score_std same_party if demand_effects==0 & age<=35


******************************************************************************** Factor Weighted Scale


*No set up so we can be consistent about what is going into the scale (CCES doesn't have setup)
factor attractiveness_score respond go_date relationship
predict interact_scale

egen interact_scale_std=std(interact_scale), mean(0) std(1)

regress interact_scale_std same_party	
	

***********************************************************
*************************Balance Tests ********************
***********************************************************

*age (already coded)

*gender
gen male = .
replace male = 1 if q3 == "Male"
replace male = 0 if q3 == "Female"

*education
gen educ = .
replace educ = 1 if q4 == "Did not graduate from high school"
replace educ = 2 if q4 == "High school graduate"
replace educ = 3 if q4 == "Some college, but no degree (yet)"
replace educ = 4 if q4 == "2-year college degree"
replace educ = 5 if q4 == "4-year college degree"
replace educ = 6 if q4 == "Postgraduate degree (MA, MBA, MD, JD, PhD, etc.)"

*marriage status
replace q5=trim(q5)
gen married=1 if q5=="Married"
replace married=0 if q5~="Married" & q5~=""

*race
replace q14_1=trim(q14_1)
gen white = 1 if q14_1~=""
replace white = 0 if q14_1==""

*sexuality
gen straight = .
replace straight = 1 if q7 == "Heterosexual/straight"
replace straight = 0 if q7 != "Heterosexual/straight" & q7 !=""

*transgender
gen trans = .
replace trans = 1 if q8 == "Yes"
replace trans = 0 if q8 != "Yes" & q8 != "Prefer not to say"

*religiosity
gen religiosity = .
replace religiosity = 1 if q16 == "Not at all important"
replace religiosity = 2 if q16 == "Slightly important"
replace religiosity = 3 if q16 == "Moderately important"
replace religiosity = 4 if q16 == "Very important"
replace religiosity = 5 if q16 == "Extremely important"

*ideology
gen ideo5 = .
replace ideo5 = 1 if q12 == "Very conservative"
replace ideo5 = 2 if q12 == "Conservative"
replace ideo5 = 3 if q12 == "Moderate"
replace ideo5 = 4 if q12 == "Liberal"
replace ideo5 = 5 if q12 == "Very liberal"

*partyid
gen democrat_respondent=1 if q13=="Democrat"
replace democrat_respondent=0 if q13=="Independent" |  q13=="Republican"

*political interest
gen poli_interest = .
replace poli_interest = 1 if q9 == "Hardly at all"
replace poli_interest = 2 if q9 == "Only now and then"
replace poli_interest = 3 if q9 == "Some of the time"
replace poli_interest = 4 if q9 == "Most of the time"

*employment
replace q10=trim(q10)
gen employed=1 if q10=="Working full time now"
replace employed=0 if q10~="Working full time now" & q10~=""

*income
tab q132
gen income = .
replace income = 1 if q132 == "Less than $10,000"
replace income = 2 if q132 == "$10,000 - $19,999"
replace income = 3 if q132 == "$20,000 - $29,999"
replace income = 4 if q132 == "$30,000 - $39,999"
replace income = 5 if q132 == "$40,000 - $49,999"
replace income = 6 if q132 == "$50,000 - $59,999"
replace income = 7 if q132 == "$60,000 - $69,999"
replace income = 8 if q132 == "$70,000 - $79,999"
replace income = 9 if q132 == "$80,000 - $89,999"
replace income = 10 if q132 == "$90,000 - $99,999"
replace income = 11 if q132 == "$100,000 - $119,999"
replace income = 12 if q132 == "$120,000 - $149,999"
replace income = 13 if q132 == "$150,000 - $199,999"
replace income = 14 if q132 == "$200,000 - $249,999"
replace income = 15 if q132 == "$250,000 - $349,999"
replace income = 16 if q132 == "$350,000 - $499,999"
replace income = 17 if q132 == "$500,000 or more"


***********************************************************
*************************Balance Tests ********************
***********************************************************

sum age male educ white democrat_respondent ideo5 employed straight trans religiosity poli_interest income



egen age_std=std(age), mean(0) std(1)

regress age_std same_party
regsave same_party using "balance_experiment_3.dta", detail(all) addlabel(outcome, age, experiment, 3) replace 


foreach var in  male educ white democrat_respondent ideo5 employed straight trans religiosity poli_interest income {
egen `var'_std=std(`var'), mean(0) std(1)
regress `var'_std same_party
regsave same_party using "balance_experiment_3.dta", detail(all) addlabel(outcome, `var', experiment, 3) append 
}


foreach var in attractiveness_score set_up respond relationship go_date ///
 age male educ white democrat_respondent ideo5 employed straight trans religiosity poli_interest income {
 
 gen `var'm=1 if `var'==.
 replace `var'm=0 if `var'~=.
 
 }
 
 foreach var in  attractiveness_score set_up respond relationship go_date ///
 age male educ white democrat_respondent ideo5 employed straight trans religiosity poli_interest income {
tab `var'm
}

rename respond respond_message
rename set_up set_up_friend

keep same_party age male educ white democrat_respondent ideo5 employed straight trans religiosity poli_interest income attractiveness_scorem set_upm respondm relationshipm go_datem agem malem educm whitem democrat_respondentm ideo5m employedm straightm transm religiositym poli_interestm incomem attractiveness_score respond_message go_date relationship set_up_friend married
gen experiment=3

rename set_upm  set_up_friendm
rename respondm respond_messagem 
rename relationshipm relationshipm
rename go_datem go_datem 

save "pared_balance_experiment_3.dta", replace


use "balance_experiment_3.dta", clear

gen t=coef/stderr

saveold "balance_experiment_3.dta", version(12) replace
	
